<?php
class Conexionesbd_Form_Crearconexion extends Form_Base {
	
		
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function init() {
		//Crea el formulario para el registro de conexiones a bd del sistema
		$this->setName ( 'conexionesbd' );
		$this->setMethod("POST");
		
		$domConfig = Zend_Registry::get('domConfig'); //esto se crea en el bootstrap
		
		$array_elements[] = new Zend_Form_Element_Hidden("codconexionbd");
		
		$element = new Zend_Form_Element_Text ( 'nombreconexion' );
		$element->setLabel ( 'Nombre de la conexión: ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
        $array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'hostconexion' );
		$element->setLabel ( 'Ip máquina o host : ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;
		
        $element = new Zend_Form_Element_Select('driver');
		$element->setLabel ( 'Driver : ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->DRIVER->toArray());
        $element->setRequired(true);
        $array_elements[]=$element;
        
		$element = new Zend_Form_Element_Text ( 'dbname' );
		$element->setLabel ( 'Nombre de la BD : ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;
			        
		$element = new Zend_Form_Element_Text ( 'username' );
		$element->setLabel ( 'Usuario de la BD : ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;
			        
		$element = new Zend_Form_Element_Text ( 'password' );
		$element->setLabel ( 'Clave de la BD : ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'charset' );
		$element->setLabel ( 'Charset : ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;
		
       $submit = new Zend_Form_Element_Submit('btnSubmit');
       $submit->setValue('Guardar');
       $submit->setLabel("Guardar");
       $submit->setAttrib("class", "iceCmdBtn");
       $array_elements[] = $submit;
       
       $this->addElements($array_elements);
	   $this->loadTableDecorators();
	}

}